package RevolCraft.GUI;

import org.lwjgl.opengl.GL11;

import RevolCraft.Containers.ContainerGenerator;
import RevolCraft.TileEntities.TileEntityGenerator;
import net.minecraft.src.GuiContainer;
import net.minecraft.src.InventoryPlayer;
import net.minecraft.src.StatCollector;
import net.minecraft.src.TileEntity;

public class GuiGenerator extends GuiContainer {
	private TileEntityGenerator te;

	public GuiGenerator(InventoryPlayer inventoryPlayer, TileEntity tileEntity)
	{
		super(new ContainerGenerator(inventoryPlayer, tileEntity));
		this.xSize = 176;
		this.ySize = 166;
		te = (TileEntityGenerator)tileEntity;
	}

	@Override
	protected void drawGuiContainerForegroundLayer(int par1, int par2) {
	    //draw text and stuff here
	    //the parameters for drawString are: string, x, y, color
	    fontRenderer.drawString("Generator", 8, 6, 4210752);
	    //draws "Inventory" or your regional equivalent
	    fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, 4210752);
	}
	
	@Override
	protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
	    //draw your Gui here, only thing you need to change is the path
	    int texture = mc.renderEngine.getTexture("/RevolCraft/Resources/guiGenerator.png");
	    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
	    this.mc.renderEngine.bindTexture(texture);
	    int x = (width - xSize) / 2;
	    int y = (height - ySize) / 2;
	    this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
	    
	    int burn = te.getBurnTimeRemainingScaled(14);
	    
	    this.drawTexturedModalRect(x + 80, y + 36 + 14 - burn, 176, 14 - burn, 14, burn);
	    
	    int storage = te.getStorageLevelScaled(52);
	    
	    this.drawTexturedModalRect(x + 8, y + 17 + 52 - storage, 176, 15 + 52 - storage, 27, storage);
	}
}
